Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds cop to enforce assert_instance_of over assert(object.instance_of?(Class)) #34

Merged
merged 1 commit into from
Oct 31, 2019

Conversation

abhaynikam
Copy link
Contributor

PR adds cops to enforce the use of assert_instance_of over assert(object.instance_of?(Class))

Ref: https://github.com/rubocop-hq/minitest-style-guide#assert-instance-of

@@ -21,6 +21,12 @@ Minitest/AssertIncludes:
Enabled: true
VersionAdded: '0.2'

Minitest/AssertInstanceOf:
Description: 'This cop enforces the use of `assert_instance_of(Class, object)` over `assert(object.instance_of?(Class))`'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a typo?

-Description: 'This cop enforces the use of `assert_instance_of(Class, object)` over `assert(object.instance_of?(Class))`'
+Description: 'This cop enforces the test to use `assert_instance_of(Class, object)` over `assert(object.instance_of?(Class))`'

module Cop
module Minitest
# This cop enforces the use of `assert_instance_of(Class, object)`
# over `assert(object.instance_of?(Class))`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abhaynikam abhaynikam force-pushed the adds-cop-for-assert-instance-of branch from 689166d to ddc7ae4 Compare October 30, 2019 16:20
@abhaynikam abhaynikam force-pushed the adds-cop-for-assert-instance-of branch from ddc7ae4 to c072f87 Compare October 30, 2019 16:23
@abhaynikam
Copy link
Contributor Author

@koic : Fixed the comments. Could you please review this PR again?

@koic koic merged commit e68681a into rubocop:master Oct 31, 2019
@koic
Copy link
Member

koic commented Oct 31, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants